﻿using System;
using SectionSignAndFilled.StairsRoomPlanSign.ModelLayer;

namespace SectionSignAndFilled.StairsRoomPlanSign.ControlLayer
{
	public class StairsDimensionPackerGeterFactory
	{
		private StairsDimensionPackerGeterFactory()
		{
		}

		public static StairsDimensionPackerGeterFactory GetFactory()
		{
			if (StairsDimensionPackerGeterFactory.m_signleTag == null)
			{
				StairsDimensionPackerGeterFactory.m_signleTag = new StairsDimensionPackerGeterFactory();
			}
			return StairsDimensionPackerGeterFactory.m_signleTag;
		}

		public bool TryGetADimensionPackerGeter(SignUseStairsPacker inputStairsPacker, out IStairsDimensionPackerGeter useGeter)
		{
			useGeter = null;
			if (!inputStairsPacker.IfGetStairesKindRight)
			{
				return false;
			}
			switch (inputStairsPacker.ThisStairsKind)
			{
			case StairsKindEnum.DoubleStairs:
				useGeter = new DoubleStairsDimensionPackerGeter(inputStairsPacker);
				return true;
			case StairsKindEnum.ScissorStair:
				useGeter = new ScissorStairDimensionPackerGeter(inputStairsPacker);
				return true;
			default:
				return false;
			}
		}

		private static StairsDimensionPackerGeterFactory m_signleTag;
	}
}
